$(function () {
    var lineChart = echarts.init(document.getElementById("echarts-line-chart"));
    var lineoption = {
        title : {
            text: '一周风险趋势'
        },
        tooltip : {
            trigger: 'axis'
        },
        legend: {
            data:['重大风险','较大风险','确定风险','疑似风险']
        },
        grid:{
            x:40,
            x2:40,
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : 'category',
                boundaryGap : false,
                data : ['周一','周二','周三','周四','周五','周六','周日']
            }
        ],
        yAxis : [
            {
                type : 'value',
                axisLabel : {
                    formatter: '{value}'
                }
            }
        ],
        series : [
            {
                name:'重大风险',
                type:'line',
                smooth:true,
                data:[1, 4, 2, 7, 6, 3, 5],
                itemStyle : {
                    normal : {
                        color:'#ed5565',
                        lineStyle:{
                            color:'#ed5565'
                        }
                    }
                },
                markPoint : {
                    data : [
                        {type : 'max', name: '最大值'},
                        {type : 'min', name: '最小值'}
                    ]
                }
            },
            {
                name:'较大风险',
                type:'line',
                smooth:true,
                data:[1, 10, 2, 5, 3, 2, 8],
                itemStyle : {
                    normal : {
                        color:'#f8ac59',
                        lineStyle:{
                            color:'#f8ac59'
                        }
                    }
                },
                markPoint : {
                    data : [
                        {type : 'max', name: '最大值'},
                        {type : 'min', name: '最小值'}
                    ]
                }
            },
            {
                name:'确定风险',
                type:'line',
                smooth:true,
                data:[20, 10, 25, 34, 35, 25, 26],
                itemStyle : {
                    normal : {
                        color:'#1c84c6',
                        lineStyle:{
                            color:'#1c84c6'
                        }
                    }
                },
                markPoint : {
                    data : [
                        {type : 'max', name: '最大值'},
                        {type : 'min', name: '最小值'}
                    ]
                }
            },
            {
                name:'疑似风险',
                type:'line',
                smooth:true,
                data:[34, 48, 34, 29, 59, 56, 49],
                itemStyle : {
                    normal : {
                        color:'#23c6c8',
                        lineStyle:{
                            color:'#23c6c8'
                        }
                    }
                },
                markPoint : {
                    data : [
                        {type : 'max', name: '最大值'},
                        {type : 'min', name: '最小值'}
                    ]
                }
            }
        ]
    };
    lineChart.setOption(lineoption);
    $(window).resize(lineChart.resize);


    var barChart = echarts.init(document.getElementById("echarts-bar-chart"));
    var baroption = {
        title : {
            text: '年度风险预警处置量'
        },
        tooltip : {
            trigger: 'axis'
        },
        legend: {
            data:['预警量','处置量']
        },
        grid:{
            x:30,
            x2:40,
            y2:24
        },
        calculable : true,
        xAxis : [
            {
                type : 'category',
                data : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
            }
        ],
        yAxis : [
            {
                type : 'value'
            }
        ],
        series : [
            {
                name:'预警量',
                type:'bar',
                data:[2, 4, 7, 23, 25, 76, 135, 162, 32, 20, 6, 3],
                markPoint : {
                    data : [
                        {type : 'max', name: '最大值'},
                        {type : 'min', name: '最小值'}
                    ]
                },
                markLine : {
                    data : [
                        {type : 'average', name: '平均值'}
                    ]
                }
            },
            {
                name:'处置量',
                type:'bar',
                data:[4, 5, 9, 26, 28, 70, 86, 150, 48, 18, 6, 5],
                markPoint : {
                    data : [
                        {name : '年最高', value : 150, xAxis: 7, yAxis: 183, symbolSize:18},
                        {name : '年最低', value : 4, xAxis: 11, yAxis: 3}
                    ]
                },
                markLine : {
                    data : [
                        {type : 'average', name : '平均值'}
                    ]
                }
            }
        ]
    };
    barChart.setOption(baroption);
    window.onresize = barChart.resize;

});
